Re: [SQL] How To Use JOIN? - Mailing list pgsql-sql

From Herouth Maoz
Subject Re: [SQL] How To Use JOIN?
Date
Msg-id l03110707b277562a7e9b@[147.233.159.109]
Whole thread Raw
In response to How To Use JOIN?  (Takashi Tokunaga <taka-tok@chaos.digital-magic.co.jp>)
List pgsql-sql
At 18:05 +0200 on 17/11/98, Takashi Tokunaga wrote:


> 3. Now after that worked without any problem, so I now create SELECT
>    statement:
>
>   select * from test1 test2 where code_1 = test.code_2 \g
>   ERROR:  attribute 'code_2' not found
>
> nope that didn't work
>
>   select test1.name_1 from test1 test2 where test1.code_1 = test2.code_2 \g
>   ERROR:  attribute 'code_2' not found

You seem to have forgotten a comma...

SELECT *
FROM test1, test2   <---- Here
WHERE code1 = code2;

if you don't put a comma, "test2" will be used as an alias to "test1", not
as a table on its own.

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma



pgsql-sql by date:

Previous
From: Takashi Tokunaga
Date:
Subject: How To Use JOIN?
Next
From: "Oliver Elphick"
Date:
Subject: Re: [SQL] How To Use JOIN?